package cn.itsource.ymcc.client.fallback;

import cn.itsource.ymcc.client.UaaFeignClient;
import cn.itsource.ymcc.domain.Login;
import cn.itsource.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UaaFeignClientFactory implements FallbackFactory<UaaFeignClient> {
    @Override
    public UaaFeignClient create(Throwable throwable) {
        return new UaaFeignClient(){
            @Override
            public JSONResult save(Login login) {
                throwable.printStackTrace();
                return JSONResult.error("登录信息保存失败");
            }
        };
    }
}
